package com.evaluation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.evaluation.entity.TeacherEvaluatingRelation;
import com.evaluation.mapper.TeacherEvaluatingRelationMapper;
import com.evaluation.service.TeacherEvaluatingRelationService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教师测评关系服务实现类
 */
@Service
public class TeacherEvaluatingRelationServiceImpl extends ServiceImpl<TeacherEvaluatingRelationMapper, TeacherEvaluatingRelation> implements TeacherEvaluatingRelationService {

    @Override
    public List<TeacherEvaluatingRelation> getPendingByTeacher(String jsxm) {
        QueryWrapper<TeacherEvaluatingRelation> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("cpjs", jsxm)
                .eq("cpbs", "0")
                .orderByAsc("bcpjs");
        return this.list(queryWrapper);
    }

    @Override
    public List<TeacherEvaluatingRelation> getEvaluatedByTeacher(String jsxm) {
        QueryWrapper<TeacherEvaluatingRelation> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("cpjs", jsxm)  // 使用Java属性名而不是数据库字段名
                .eq("cpbs", "1")  // 已测评
                .orderByDesc("cpsj");
        return this.list(queryWrapper);
    }
}
